<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
    <style>
        .marquee-bar {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 30px;
            color: #E56F32;
            background: #ff51001a;
            line-height: 30px;
            overflow: hidden;
            text-align: center;
        }
    </style>
</head>
<body>
    <!--marquee-->
    <div class="marquee-bar" direction="up" behavior="scroll" loop="-1" scrollamount="2" scrolldelay="100">
        <div>大包小包回家过年</div>
        <div>被媳妇打一顿</div>
    </div>
</body>
<script>
    $(function(){
        function marqueeBarAnimation() {
            var barDom = $('.marquee-bar');
            autoScroll(barDom);
            setInterval(function () {
                autoScroll(barDom)
            }, 2500);

            function autoScroll(jqdom) {
                jqdom.find("div:first").animate({
                    marginTop: "-30px",
                    easing: "linear"
                }, 1500, function () {
                    $(this).css({
                        marginTop: "0px"
                    }).appendTo($(this).parent());　　//函数appendTo()把第一个挪到最后一个
                });
            };
        }
        marqueeBarAnimation()
    })
</script>
</html>